package zozopo.user;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class LoginOutAction extends ActionSupport implements Action,ServletResponseAware  {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private HttpServletResponse response;
	
	public String execute(){
		
		Cookie cookie = new Cookie("SESSIONID", "");
		cookie.setMaxAge(0);   //秒
		response.addCookie(cookie); 
		
		
		ActionContext.getContext().getSession().clear();
		return SUCCESS;
	}

	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		response= arg0;
	}

	
} 
